

import socket
import threading
import thread
import SocketServer
import time
import pdb
import pickle
import Queue
import urllib2

g = 1


def test(): 
    try:
        global g
        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 
        sock.connect(('127.0.0.1', 8000)) 
        str = "%d"%g
        sock.sendall(str) 
        g=g+1
    except :
        pass
#    recvData = sock.recv(MAX_PACKET_SIZE) 
#    print 'Recv from server', recvData 
    sock.close() 
    
    
def ptest():
    print("hello")

if __name__ == '__main__': 
    for i in range(1000): 
        th = threading.Thread(target = test)
        th.start()
        time.sleep(0.1) 

#    test()
    time.sleep(100)
